Skip to main content

Rosbags

General Notes​

  • Never rename Rosbags using mv!
    • use rosbag record -O session2_090210.bag /chatter (see doc)

Help​

Show all the available options:

ros2 bag play -h

Playback Rate​

ros2 bag play rosbag2_2022_11_05-14_22_01/ --rate 0.1

Recording Data​

Pre-requisites​

Before you record a Rosbag set the Realsense camera's ROS image publishing rate (FPS) to an appropriate value. (Note: The ROS image publishing rate can differ from the camera's frame rate!)

Extract "ros2 bag" to jpg images​

Prerequisites:

sudo apt install ros-foxy-image-view
sudo apt install ros-foxy-image-transport-plugins

Then, replay the Rosbag2 using

ros2 bag play rosbag2_2022_11_05-14_22_01/

and dump the image frames from the image topic /camera/color/image_raw to .jpg files in the current directory using the following command:

ros2 run image_view extract_images raw --ros-args -r image:=/camera/color/image_raw

Filtering Images for Labelling​

For some reason the command

ros2 run image_view extract_images raw --ros-args -r image:=/camera/color/image_raw -p sec_per_frame:=0.5

did not work, i.e. the sec_per_frame parameter can be changed, but this does not change the extraction frame rate.

Workaround:

  • Filter the extracted images manually by using a command like rm *1.jpg *3.jpg *5.jpg *7.jpg *9.jpg instead.